'''
Created on Nov 23, 2012

@author: peng
'''
import ldap

AD_DNS_NAME = '119.97.214.98'
AD_LDAP_PORT = 389
AD_LDAP_URL = 'ldap://%s:%s' % (AD_DNS_NAME, AD_LDAP_PORT)

AD_NT4_DOMAIN = 'BAINA.COM'

binddn = "%s@%s" % ('prong', AD_NT4_DOMAIN)

try:
    l = ldap.initialize(AD_LDAP_URL)
    l.simple_bind_s(binddn, 'Bei312jing!')
    l.unbind_s()
except ldap.LDAPError:
    print 'dddd'
